package com.water.service.impl;

import com.water.dao.BeOrderliteDao;
import com.water.entity.BeOrderlite;
import com.water.service.BeOrderliteService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (BeOrderlite)表服务实现类
 *
 * @author makejava
 * @since 2020-12-14 19:18:47
 */
@Service("beOrderliteService")
public class BeOrderliteServiceImpl implements BeOrderliteService {
    @Resource
    private BeOrderliteDao beOrderliteDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public BeOrderlite queryById(Integer id) {
        return this.beOrderliteDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<BeOrderlite> queryAllByLimit(int offset, int limit) {
        return this.beOrderliteDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param beOrderlite 实例对象
     * @return 实例对象
     */
    @Override
    public BeOrderlite insert(BeOrderlite beOrderlite) {
        this.beOrderliteDao.insert(beOrderlite);
        return beOrderlite;
    }

    /**
     * 修改数据
     *
     * @param beOrderlite 实例对象
     * @return 实例对象
     */
    @Override
    public BeOrderlite update(BeOrderlite beOrderlite) {
        this.beOrderliteDao.update(beOrderlite);
        return this.queryById(beOrderlite.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.beOrderliteDao.deleteById(id) > 0;
    }
}